#!/bin/sh

repo=$1
output=${2:-""}
outputDefault="src"
src=$([ "$output" = "" ] && echo $outputDefault || (echo $output))

if [ ! -d ${src} ] ; then
	mkdir ${src}
fi

cd ${src}

# ---------- ---------- ---------- ---------- ---------- ----------
#NOTE: The following catches errors without halting the entire process.
#
#	Credit:
#	http://bobbelderbos.com/2012/07/simple-bash-script-to-clone-remote-git-repositories/
#
# ---------- ---------- ---------- ---------- ---------- ----------
cloneCmd="git clone ${repo}"
cloneCmdRun=$($cloneCmd 2>&1)
echo -e "Running: \n$ $cloneCmd"
echo -e "${cloneCmdRun}\n\n"
